using NHibernate;
using NHibernate.Criterion;
using Web.Model;

namespace Web.DataAccess
{
	public class UserByEmailQuery
	{
		private string Email { get; set; }
        public UserByEmailQuery(string email)
        {
            Email = email;
        }
		public User Load(ISession session)
		{
			return session
				.CreateCriteria<User>()
				.Add(Restrictions.Eq("Email", Email))
				.UniqueResult<User>();
		}
	}
}